import 'package:flutter/material.dart';
import 'package:flutter_api/modules/common/common_tab_page.dart';
import 'package:flutter_api/modules/widget_basic/pages/button_page.dart';
import 'package:flutter_api/modules/widget_basic/pages/form_page.dart';
import 'package:flutter_api/modules/widget_basic/pages/image_page.dart';
import 'package:flutter_api/modules/widget_basic/pages/slider_page.dart';
import 'package:flutter_api/modules/widget_basic/pages/switch_radio_check_page.dart';
import 'package:flutter_api/modules/widget_basic/pages/text_page.dart';

class BasicWidgetScreen extends StatefulWidget {
  static const String routeName = "/basic/widget";

  @override
  _BasicWidgetScreenState createState() => _BasicWidgetScreenState();
}

class _BasicWidgetScreenState extends CommonTabPageState<BasicWidgetScreen> {
  @override
  String getFileName(int index) {
    String fileName = "";
    switch (index) {
      case 0:
        fileName = "text";
        break;
      case 1:
        fileName = "button";
        break;
      case 2:
        fileName = "image";
        break;
      case 3:
        fileName = "slider";
        break;
      case 4:
        fileName = "switch_radio_check";
        break;
      case 5:
        fileName = "form";
        break;
    }
    return fileName;
  }

  @override
  List<Widget> getPages() {
    return [
      TextPage(),
      ButtonPage(),
      ImagePage(),
      SlidePage(),
      SwitchRadioCheckButtonPage(),
      FormPage(),
    ];
  }

  @override
  List<Tab> getTabs() {
    return [
      Tab(text: '文本'),
      Tab(text: '按钮'),
      Tab(text: '图片'),
      Tab(text: '滑动条'),
      Tab(text: '开关、单、多选按钮'),
      Tab(text: '表单'),
    ];
  }
}
